<template>
	<view>
		<!--#ifdef APP-PLUS-->
		<view class="lz-status_bar">
			<view class="lz-top_view"></view>
		</view>
		<!--#endif-->
		<view class="kaoshi-head">
			<view class="kaoshi-head-top">
				<view class="kaoshi-head-left" @tap="navigateBack">
				<view class="iconfont icon-zuojiantou"></view>
				</view>
				<view class="kaoshi-head-m">练习报告</view>
			</view>
		</view>
		<view class="kaoshi-question-over">
			<view class="kaoshi-baogao">
				<view class="kaoshi-baogao-title"><view class="kaoshi-baogao-title-l">{{pages_params.zhengquelv}}</view>%</view>
				<view>正确率</view>
			</view>
			<view class="kaoshi-question-over-content">
				<view class="kaoshi-question-over-content-flex">
					<view>练习时间</view>
					<view class="kaoshi-question-over-content-time">{{use_time}}</view>
				</view>
				<view class="kaoshi-question-over-content-flex">
					<view>答对</view>
					<view class="kaoshi-question-over-content-num">
						<span>{{pages_params.right_num || 0}}</span>
						<view>/{{pages_params.total_num || 0}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>

export default {
	data(){
		return {
			pages_params: {}
		}
	},
	computed:{
		use_time() {
			let start = this.pages_params.start_time || 0
			let end = (new Date()).getTime()
			let sec = parseInt((end -start) / 1000);
			let hour = parseInt(sec / 3600);
			let miu = parseInt((sec - hour * 3600) / 60);
			let s = sec - hour * 3600 - miu * 60;
			// formatDigit
			hour = this.$myUtils.$common.formatDigit(hour)
			miu = this.$myUtils.$common.formatDigit(miu)
			s = this.$myUtils.$common.formatDigit(s)
			return `${hour}:${miu}:${s}`
		}
	},
	components: {},
	onLoad(opts) {
		this.pages_params = opts;
		this.pages_params.zhengquelv = parseInt(this.pages_params.zhengquelv).toFixed(0)
  },
  methods: {
	  navigateBack(){
		  uni.navigateBack(2);
	  },
    goto_detail(type) {
			if (type === 2) {
				this.$openrul('/src/pages/mine/learn/wrongQuestion/list?unit_id='+this.pages_params.unit_id);
			} else {
        this.$openrul('/src/pages/mine/learn/collect/list?unit_id='+this.pages_params.unit_id)
			}
		}
  }
};
</script>

<style>
page {
	background: #fff;
}
/*练习报告*/
.kaoshi-question-over {
	background: #fff;
}
.kaoshi-question-over-content {
	display: flex;
	width: 80%;
	margin: 0 auto;
	justify-content: space-between;
	font-size: 16px;
	color: #9a9a9a;
}
.kaoshi-question-over-content-flex {
	flex: 1;
	text-align: center;
}
.question-over-content .kaoshi-question-over-content-flex:first-child {
	border-right: solid 1px #f5f5f5;
}
.kaoshi-question-over-content-time {
	color: #000;
	font-size: 20px;
	padding-top: 4px;
}
.kaoshi-question-over-content-num {
	font-size: 16px;
	padding-top: 4px;
	display: flex;
	align-items: baseline;
	justify-content: center;
}
.question-over-content-num span {
	color: #000;
	font-size: 20px;
}
.kaoshi-baogao{
	background: url() no-repeat;
	background-size: contain;
	width: 180px !important;
	height: 180px;
	margin: 33px auto;
	text-align: center;
	color: #000;
	display: flex;
	align-items: center;
	flex-direction: column;
}
.kaoshi-baogao-title{
    padding-top: 32%;
	display: flex;
	align-items: baseline;
}
.kaoshi-baogao-title-l{
	font-size: 32px;
}
</style>
